import time

def simple_middleware(get_response):
    def middleware(request):
        print('run before')
        start = time.time()
        response = get_response(request)
        print('run after')
        print('cost:',time.time()-start)
        # 执行用户，当前请求url， 花费的时间
        return response
    return middleware